package com.tsinghuabigdata.edu.ddmath.MVPView;

import android.os.Bundle;

import com.tsinghuabigdata.edu.ddmath.MVPPresent.MVPBasePresent;
import com.tsinghuabigdata.edu.ddmath.R;
import com.tsinghuabigdata.edu.ddmath.activity.RoboForActionBarActivity;


/**
 * Created by 28205 on 2016/12/13.
 */
public abstract class MVPBaseActionBarActivity<V extends IMVPBaseView, P extends MVPBasePresent> extends RoboForActionBarActivity implements IMVPBaseView {

    protected P presenter;

    @SuppressWarnings("unchecked")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTheme(R.style.AppTheme);
        presenter = createPresenter();
        presenter.attachView(this); //presenter取得与界面的联系
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        presenter.detachView();//presenter断开与界面的联系
    }
    

    protected abstract P createPresenter();
}